<?php

declare(strict_types=1);

namespace App\Model;


/**
 * @property int $id ID
 * @property string $match_id 比赛ID
 * @property int $userid 用户ID
 * @property int $add_time 添加时间
 * @property int $notice_time 通知时间
 * @property-read null|Play $match 
 * @property-read null|\Hyperf\Database\Model\Collection|Live[] $live 
 */
class PlayCollect extends Model
{
    /**
     * The table associated with the model.
     */
    protected ?string $table = 'play_collect';

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = ['id', 'match_id', 'userid', 'add_time', 'notice_time'];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['id' => 'integer', 'userid' => 'integer', 'add_time' => 'integer', 'notice_time' => 'integer'];

    public function match()
    {
        return $this->hasOne(Play::class, 'match_id', 'match_id');
    }

    public function live()
    {
        return $this->hasMany(Live::class, 'match_id', 'match_id');
    }
}
